From 0943c9f6b2c3ad5827ae5d8f3742f75e72782e41 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sat, 4 Jun 2016 20:57:23 +0900 Subject: [PATCH] scrolledwindow: Bug 766569 - Report child natural size unconditionally This patch causes the scrolled window default behavior to change in such a way that the natural size request of the child is unconditionally reported, which probably should have been the case since day 1. This should not cause significant fallout since a scrolled window is normally used to expand/fill, eating up remaining space for scrollable content - it will however cause the scrolled window to compete for additional space with siblings, proportionally to the size of the scrolled window's content. --- gtk/gtkscrolledwindow.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 1ef826b108..c6a9ca4bf2 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1781,17 +1781,18 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, &min_child_size, &nat_child_size); + natural_req.width += nat_child_size; + if (priv->hscrollbar_policy == GTK_POLICY_NEVER) { minimum_req.width += min_child_size; - natural_req.width += nat_child_size; } else { if (priv->min_content_width >= 0) { minimum_req.width += priv->min_content_width; - natural_req.width += priv->min_content_width; + natural_req.width = MAX (priv->min_content_width, natural_req.width); extra_width = -1; } @@ -1822,17 +1823,18 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, &min_child_size, &nat_child_size); + natural_req.height += nat_child_size; + if (priv->vscrollbar_policy == GTK_POLICY_NEVER) { minimum_req.height += min_child_size; - natural_req.height += nat_child_size; } else { if (priv->min_content_height >= 0) { minimum_req.height += priv->min_content_height; - natural_req.height += priv->min_content_height; + natural_req.height = MAX (priv->min_content_height, natural_req.height); extra_height = -1; } -- 2.30.2